﻿using Application.AppService.LoginAppService;
using AutoMapper;
using Domain.Entity.user;
using Microsoft.AspNetCore.Mvc;

namespace UI.Controllers
{
    public class UserController : Controller
    {
        private readonly IUserAppService userAppService;
        private readonly IMapper mapper;

        public UserController( IUserAppService userAppService,IMapper mapper) 
        {
            this.userAppService = userAppService;
            this.mapper = mapper;
        }
        public IActionResult Index()
        {
            return View();
        }
     

        [HttpPost]
        
        public async Task<IActionResult> GetUser( UserAddDto userAddDto)
        {
            Users users=mapper.Map<Users>(userAddDto);
            Users users1=await userAppService.GetUsers(users);
            return Json(users1);
        }

    }
}
